package dgut.bbm.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import dgut.bbm.common.utils.PageUtils;
import dgut.bbm.common.utils.Query;

import dgut.bbm.dao.GoodsPicDao;
import dgut.bbm.entity.GoodsPicEntity;
import dgut.bbm.service.GoodsPicService;


@Service("goodsPicService")
public class GoodsPicServiceImpl extends ServiceImpl<GoodsPicDao, GoodsPicEntity> implements GoodsPicService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<GoodsPicEntity> page = this.page(
                new Query<GoodsPicEntity>().getPage(params),
                new QueryWrapper<GoodsPicEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<GoodsPicEntity> getImgByGoodsId(Long goodsId) {
        QueryWrapper<GoodsPicEntity>queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("goods_id",goodsId);
        return baseMapper.selectList(queryWrapper);
    }

}